#!/usr/bin/env python
#
# Copyright 2007, Doug Hellmann.
#
"""

"""

__version__ = "$Id$"

# Import system modules
from django.conf.urls.defaults import *
from django.contrib import databrowse

# Import local modules
from models import *

# Module

urlpatterns = patterns(
    '',

    # Start by showing the decade list
    (r'^$', 'django.views.generic.simple.redirect_to', {'url':'arrest/decade/'}),

    # Show all decades
    (r'^arrest/$', 'django.views.generic.simple.redirect_to', {'url':'decade/'}),

    # Show years in a single decade
    (r'^arrest/decade/$', 'docket.arrest.decade_list'),
    (r'^arrest/decade/(?P<decade>\d\d\d\d)/$', 'docket.arrest.decade'),

    # Redirect a year to Jan of that year
    (r'^arrest/month/(?P<year>\d\d\d\d)/$', 'django.views.generic.simple.redirect_to',
     {'url':'01/'}),

    # Redirect cases/1909/1 to cases/1909/01 for consistency
    (r'^arrest/month/(?P<year>\d\d\d\d)/(?P<month>\d)/$', 
     'django.views.generic.simple.redirect_to',
     {'url':'../0%(month)s/'}),

    # Show the cases in a month
    (r'^arrest/month/(?P<year>\d\d\d\d)/(?P<month>\d+)/$', 'docket.arrest.month'),

    # Show a case
    (r'^case/(?P<year>\d\d\d\d)/(?P<casenum>.+)/$', 'docket.views.case'),
    
    # Search for something
    (r'^search/', 'docket.views.search'),

    )
